
#pragma once

#include "MzWndEx.h"

#define POPUP_MENUE_ITEM_HEIGHT		95
#define POPUP_MENUE_ITEM_WIDTH		450
#define POPUP_MENUE_ITEM_TOP		14
#define POPUP_MENUE_ITEM_BOTTOM		14
//#define POPUP_MENUE_ITEM_SPACE_V	10
#define POPUP_DISPLAY_STRING_HEIGHT  50

#define POPUP_MENUE_WND_HEIGHT(x)	POPUP_MENUE_ITEM_TOP\
					+POPUP_MENUE_ITEM_HEIGHT*(x) + POPUP_MENUE_ITEM_BOTTOM

					

//#define POPUP_MENUE_ITEM_X			28
#define POPUP_MENUE_ITEM_Y(i)		POPUP_MENUE_ITEM_TOP\
					+POPUP_MENUE_ITEM_HEIGHT*(i) + POPUP_MENUE_ITEM_BOTTOM
					

struct  MZFC_API PopupMenuItemProp
{
	CMzString str;
	int itemCr;
	int itemRetID;
};

class MZFC_API CPopupMenu : public CMzWndEx
{
public:
	CPopupMenu(const TCHAR *pString = NULL);
	virtual ~CPopupMenu(void);	
	void PaintWin(HDC hdc, RECT* prcUpdate = NULL);
	virtual BOOL OnInitDialog(void);
	virtual void OnMzCommand(WPARAM wParam, LPARAM lParam);
	virtual void OnSettingChange(DWORD wFlag, LPCTSTR pszSectionName);
	virtual LRESULT MzDefWndProc(UINT message, WPARAM wParam, LPARAM lParam);
	void AddItem(struct PopupMenuItemProp& pmip){m_vPMIP.push_back(pmip);}
	int GetHeight()
	{
		if( m_pDisplayStr == NULL )
		{
			return POPUP_MENUE_WND_HEIGHT(m_vPMIP.size());
		}
		else
		{
			return POPUP_MENUE_WND_HEIGHT(m_vPMIP.size()) +POPUP_DISPLAY_STRING_HEIGHT;
		}
	}
private:
	void _DrawBackGround( HDC hdc );
	bool _isSpaceEnough(HDC hdc, int editWidth,const TCHAR* strDtmf, int displayStrlen );
	HDC m_hDcBG;
	HBITMAP m_hbmp;
	const TCHAR *m_pDisplayStr;
	std::vector<struct PopupMenuItemProp> m_vPMIP;
	BOOL m_bChangeDisplay;
};
